//
//  AopManager.m
//  ShopNet
//
//  Created by chenguibang on 2017/3/6.
//  Copyright © 2017年 chenguibang. All rights reserved.
//

#import "AopManager.h"
#import "ShopNet.h"
#import <Aspects/Aspects.h>



typedef void(^SusBlock)(NSURLSessionDataTask *task, id _Nullable responseObject);
@implementation AopManager
+(void)setupLog:(BOOL)on{
    NSError *error = nil;
    [ShopNetTool aspect_hookSelector:@selector(GET:parameters:progress:success:failure:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> aspectInfo,NSString *url ,id parameters,SusBlock success){
        
//        NSLog(@"print log ： \n%@\n%@\n%@" ,url,parameters,success);
    }error:&error];
    
    
    [AFURLSessionManager aspect_hookSelector:@selector(URLSession:task:didCompleteWithError:) withOptions:AspectPositionBefore usingBlock:^(id<AspectInfo> aspectInfo,NSURLSession *session,NSURLSessionTask *task,NSError *error){
    
//        NSLog(@"print log 请求回来了 :  %@:",task.response);
    }error:&error];
    
}
@end
